pub fn parse_percentage(input: &str) -> Result<u32, String> {
    // TODO: Implement the function here
    let tmp: Vec<char> = input.to_string().chars().collect();
    //println!("{:?}", tmp);
    let len = tmp.len();
    let mut loop_time = len - 1;
    let mut sum: u32 = 0_u32;
    let mut err: bool = false;
    while loop_time >= 0 {
        let a = tmp[loop_time];
        println!("a {}", a);
        let parse_v: u8 = match a.try_into() {
            Ok(v) => {
                println!("v {}", v);
                v
            }
            _ => {
                err = true;
                break;
            }
        };
        dbg!(parse_v);
        println!("x {}", 10_u32.pow(((len - 1) - loop_time) as u32));
        sum += parse_v as u32 * 10_u32.pow(((len - 1) - loop_time) as u32);
        if loop_time == 0 {
            break;
        } else {
            loop_time -= 1;
        }
    }
    dbg!(err);
    dbg!(sum);
    let out = if err {
        Err(String::from("Invalid input"))
    } else if sum >= 0 && sum <= 100 {
        Ok(sum)
    } else {
        Err(String::from("Percentage out of range"))
    };
    out
    //Ok(0)
}
